package bg.btanev.eightyfour.domain.profile.feed;

import org.apache.commons.lang.StringUtils;

import bg.btanev.eightyfour.domain.entitybase.DomainValue;

/**
 *
 * @author B.Tanev
 *
 */
public class FeedMediaContentMeta implements DomainValue {
	/**
	 *
	 */
	private static final long serialVersionUID = -4689166398719691096L;

	private String title;
	private String description;

	protected FeedMediaContentMeta() {
	}

	public FeedMediaContentMeta(final String title, final String description) {
		super();

		if (StringUtils.isEmpty(title) && StringUtils.isEmpty(description)) {
			throw new IllegalArgumentException("both parameters cannot be null.");
		}

		this.title = title;
		this.description = description;
	}

	public String getTitle() {
		return title;
	}

	public String getDescription() {
		return description;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((description == null) ? 0 : description.hashCode());
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FeedMediaContentMeta other = (FeedMediaContentMeta) obj;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "FeedMediaContentMeta [description=" + description + ", title=" + title + "]";
	}
}
